#!/usr/bin/env bash

function set_current_alias()
{
  typeset __current_ruby

  if
    __current_ruby="${rvm_environments_path}/current" &&
    [[ -L "${__current_ruby:-}" ]]
  then
    __current_ruby="$( readlink "${__current_ruby:-}" )"
    __current_ruby="${__current_ruby##*/}"
  fi
  if
    [[ -z "${__current_ruby}" || "${__current_ruby}" != "${rvm_ruby_string}" ]]
  then
    "$rvm_scripts_path/alias" create current "${rvm_ruby_string}"
  fi
}

if
  [[ $TM_WRAPPING != "1" ]]
then
  export TM_WRAPPING="1"
  set_current_alias
  unset TM_WRAPPING
fi
